<%@ page import="com.conversationboard.model.*" %>
<%@ page import="com.conversationboard.view.*" %>
<%@ page import="com.conversationboard.config.*" %>
<%@ page import="com.conversationboard.controller.confirm.Confirm" %>
<%@ page import="java.security.Principal"%>

<%@ page pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=UTF-8"%>

<%
	int boardId = (Integer) request.getAttribute("boardid");
	int threadId = (Integer) request.getAttribute("threadid");
	
	User user = User.getAnonymousUser();
	Principal principal = request.getUserPrincipal();
	user = User.get(principal.getName());
	
%>

<html>

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
		<title>Move a Thread to a Different Board</title>
		<link rel="stylesheet" type="text/css" href="<%=Configuration.getInstance().getRoot()%>/Stylesheets/<%=StyleSheets.getStyleSheetFileName(request.getCookies())%>"/>
		
		<script language="JavaScript">

			function disableForm(theform) {

				if (document.all || document.getElementById) {

					for (i = 0; i < theform.length; i++) {
						var tempobj = theform.elements[i];
						if (tempobj.type.toLowerCase() == "submit" || tempobj.type.toLowerCase() == "reset")
						tempobj.disabled = true;
					}
					
					return true;
					
				}
			}
			
		</script>		
	</head>

	<body>
	
		<%= MainMenu.display(principal) %>
	
		<div class="headingblock">
			<h1>Move a Thread to a New Board</h1>
		</div>

		<div class="mainblock">
			
			<div class="formsection">

			<p>Please select the board you wish to move the thread. Board admins may only move thread from board for which they are an 
			   admin to another board, for which they are also an admin. </p>
		
			<form class="formsectionlight" action='<%=Configuration.getInstance().getRoot()%>/Admin/AdminMoveThreadControllerServlet' method=POST onSubmit='return disableForm(this);'>
			
			 	<input name="boardid" value="<%=boardId%>" type="hidden" />
			 	<input name="threadid" value="<%=threadId%>" type="hidden" />
				<%= Confirm.getKey(request.getUserPrincipal().getName()) %>
			
				<%= SelectBoardDisplay.display(user) %>
				<br /><br />
			 	<input type="submit" value="Move Thread" />
			 	<input type="reset" value="Clear" />
			</form>
			
			</div>
			
		</div>

		<!--<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>-->
		<!--<script type="text/javascript">_uacct = "UA-1148679-1";urchinTracker();</script>--> 

	</body>
	
</html>
